import { Control } from 'react-keeper';

require('./PageUserbind.styl');
const ui = require('clientConfig/util/jsapi/ui');
const reactMixin = require('react-mixin');
const Actions = require('./actions');
const Store = require('./store');
const { SelectField, Boxs, Toast } = SaltUI;

const nodeList = {
    role: [
        { value: 0, text: '乙方' },
        { value: 1, text: '三方测试' },
        { value: 2, text: '专家' },
        { value: 3, text: '甲方' },
        { value: 4, text: '监理' },
        ]
}
class Userbind extends React.Component {

    constructor(props) {
        super(props);
        this.state = {
            options_role: nodeList.role,
        };
    }
    handleTextChange(name, newValue) {
        let t = this;
        this.setState({
            [name]: newValue
        });
    }
    
    handleSumbmit() {
        let data = Control.state;
        data.role = this.state.role;
        Actions.check({ result:data});
    }
    render() {
        let t = this;
        return (
            <div className="userbind">
                <SelectField
                    label="角色"
                    placeholder="请选择(必填)"
                    value={t.state.role}
                    options={t.state.options_role}
                    onSelect={t.handleTextChange.bind(t, 'role')}
                />
                <div className="complete t-FAC" onClick={t.handleSumbmit.bind(t)}>确定</div>
            </div>
        );
    }

    componentWillMount() {
    }

    componentDidMount() {
        ui.setTitle({ title: '用户绑定' })
    }

    componentWillReceiveProps(nextProps) {
    }

    shouldComponentUpdate(nextProps, nextState) {
        return true;
    }

    componentWillUpdate(nextProps, nextState) {

    }

    componentDidUpdate(prevProps, prevState) {
   
    }

    componentWillUnmount() {
    }
}

reactMixin.onClass(Userbind, Reflux.connect(Store));

module.exports = Userbind;
